function ModuleDialogObject(doc, container, width, height, user, date, options) {
  this._doc = doc;
  this._container = container;
  this._width = width;
  this._height = height;
  this._user = user;
  this._date = date;
  this._options = options;
  
  this._item = (options && options.object) ? options.object : null;
  this._name = (options && options.name) ? options.name : null;
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : function() {};
  this._popupBox = new ModulePopupBoxSimple();
  
  this._createElements();
};

ModuleDialogObject.prototype._createElements = function() {
  var tr, td;
  this._gui = new DialogObject(this._doc, this._container, this._width, this._height, this._user, this._date, this._options, this._data)._gui;

  tr = this._gui.objects.insertRow(-1);
  td = tr.insertCell(-1);
  td.colSpan = 6;
  td.appendChild(DOMUtils.getLoadingImage());
  this._loadData();
};

ModuleDialogObject.prototype._loadData = function() {
  this._objects = null;
  this._retrieveObjects();
};

ModuleDialogObject.prototype._verifyData = function() {
  if (this._objects) {
    this._updateElements();
  }
};

ModuleDialogObject.prototype._retrieveObjects = function() {
  var _self = this;
  new RequestUtils()._read(this._name, null, null, null, null, null, null, function(result, params) { _self._objects = result.data;
                                                                                                      _self._verifyData.call(_self);
                                                                                                    }, null);
};

ModuleDialogObject.prototype._updateElements = function() {
  var table, tr, td, radio, input, _self = this;
  DOMUtils.removeTableRows(this._gui.objects, 1);
  
  this._gui.object.value = '';
  this._gui.object.onchange = function() { _self._item.name = this.value; };
  
  this._gui.add.onclick = function() { if (_self._item.name == '') {
                                         window.alert('CAN NOT BE EMPTY');
                                         return;
                                       }
                                       _self._callbackFunc();
                                     };
  
  MiscUtils.sort(this._objects, ['name']);
  
  if (this._objects.length == 0) {
    tr = this._gui.objects.insertRow(-1);
    td = tr.insertCell(-1);
    td.colSpan = 3;
    td.style.textAlign = 'center';
    td.appendChild(document.createTextNode('N/A'));
  }
  
  for (var i = 0, il = this._objects.length; i < il; i++) {
    var obj = this._objects[i];
    if (i % 3 == 0) {
      tr = this._gui.objects.insertRow(-1);
    }
    td = tr.insertCell(-1);
    td.style.height = '20px';
    td.style.paddingLeft = '10px';
    td.style.textAlign = 'left';
    td.style.width = '210px';
    if (obj.name && obj.name.length > 30) {
      td.appendChild(document.createTextNode(obj.name.substring(0, 30)));
      var a = document.createElement('a');
      a.href = '#';
      a.appendChild(document.createTextNode('...'));
      a._obj = obj;
      a.onclick = function() { var pos = DOMUtils.findPos(this);
                               var div = document.createElement('div');
                               func1 = function() { _self._popupBox._close(); };
                               div.appendChild(MiscUtils.span('\n' + this._obj.name));
                               MiscUtils.dialog(_self._popupBox, pos, div, func1, null);
                               return false;
                             };
      td.appendChild(a);
    } else {
      td.appendChild(document.createTextNode(obj.name));
    }
    td = tr.insertCell(-1);
    td.style.textAlign = 'center';
    td.style.width = '30px';
    var remove = document.createElement('img');
    remove.src = 'image/delete.png';
    remove.style.cursor = 'pointer';
    remove._obj = obj;
    remove.onclick = function() { var pos = DOMUtils.findPos(this);
                                  new RequestUtils()._write(_self._name, [], [this._obj], function() { _self._retrieveObjects(); }, { pos: pos });
                                };
    td.appendChild(remove);
  }
};
